<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">

<head>
    <title>商铺新增页面</title>
    <#include "../common/htmlHeard.ftl">
</head>

<body>
<div class="x-body">
    <form role="form" class="layui-form" method="post" action="/admin/shop/saveOrUpdate">
        <div class="layui-form-item">
            <label for="L_email" class="layui-form-label">
                <span class="x-red">*</span>商铺编号
            </label>
            <div class="layui-input-inline">
                <input type="text" name="shopType" lay-verify="required" required="" autocomplete="off" class="layui-input" value="${(shop.shopType)!''}">
            </div>
        </div>
        <div class="layui-form-item">
            <label for="L_email" class="layui-form-label">
                <span class="x-red">*</span>商铺名称
            </label>
            <div class="layui-input-inline">
                <input type="text" name="shopName" lay-verify="required" required="" autocomplete="off" class="layui-input" value="${(shop.shopName)!''}">
            </div>
        </div>
        <input hidden type="text" name="foodId" value="${(shop.shopId)!''}">
        <div class="layui-form-item">
            <label for="L_repass" class="layui-form-label">
            </label>
            <input value="增加" type="submit" class="layui-btn" lay-filter="add" lay-submit=""></input>
        </div>
    </form>
</div>
<script>
    layui.use(['form','layer'], function(){
        $ = layui.jquery;
        var form = layui.form
                ,layer = layui.layer;

        //自定义验证规则
        form.verify({
            shopType: function(value){
                if(value !== null || value !== undefined || value !== ''){
                    return '菜单名称不能为空';
                }
            }
            ,pass: [/(.+){6,12}$/, '密码必须6到12位']
            ,repass: function(value){
                if($('#L_pass').val()!=$('#L_repass').val()){
                    return '两次密码不一致';
                }
            }
        });

        //监听提交
        form.on('submit(add)', function(data){
            //发异步，把数据提交给php
            layer.alert("增加成功", {icon: 6},function () {
            // 获得frame索引
            var index = parent.layer.getFrameIndex(window.name);
            //关闭当前frame
            parent.layer.close(index);
            });
            // return false;
        });
    });
</script>
<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>

</html>